package Visual;

/*
 * The contents of this file are subject to the terms of the Common Development
 * and Distribution License (the License). You may not use this file except in
 * compliance with the License.
 *
 * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
 * or http://www.netbeans.org/cddl.txt.
 *
 * When distributing Covered Code, include this CDDL Header Notice in each file
 * and include the License file at http://www.netbeans.org/cddl.txt.
 * If applicable, add the following below the CDDL Header, with the fields
 * enclosed by brackets [] replaced by your own identifying information:
 * "Portions Copyrighted [year] [name of copyright owner]"
 *
 * The Original Software is NetBeans. The Initial Developer of the Original
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
 * Microsystems, Inc. All Rights Reserved.
 */

import DBObjects.dbColumn;
import DBObjects.dbForeignKey;
import DBObjects.dbTable;
import java.awt.Color;
import org.netbeans.api.visual.widget.LabelWidget;



/**
 * @author Adriano Aristarco
 */
public class TreeGraphLayoutTest extends GraphSceneDb {

    public TreeGraphLayoutTest () {

    }

    public static void main (String[] args) {
        TreeGraphLayoutTest scene = new TreeGraphLayoutTest ();

        dbTable test = new dbTable("esempio");
        dbColumn col1 = test.addColumn("sorgente", "number");
        test.addColumn("colonna2", "varchar2");
        dbTable test2 = new dbTable("esempio2");
        dbColumn col2 = test2.addColumn("destinazione", "varchar2");
        dbTable test3 = new dbTable("esempio3");
        test3.addColumn("colonna1", "date");
        dbTable test4 = new dbTable("difridi");
        test4.addColumn("ghiri", "date");
        test4.addColumn("bruttezza", "number");
         
        dbForeignKey fk = new dbForeignKey(test2,test);
        test2.addForeignKey(fk);
        
        fk.addColumnCoupleToFk(col2,col1);

        dbForeignKey fk2 = new dbForeignKey(test3,test2);
        test3.addForeignKey(fk2);

        //dbForeignKey fk3 = new dbForeignKey(test,test2);
        //test3.addForeignKey(fk3);

        dbForeignKey fk4 = new dbForeignKey(test3,test);
        test3.addForeignKey(fk4);
 
        dbForeignKey fk5 = new dbForeignKey(test4,test2);
        test4.addForeignKey(fk5);
        
        scene.addDbNode(test);
        scene.setRootNode(test);
        scene.addDbNode(test2);


        scene.addDbNode(test3);
        scene.addDbNode(test4);


        SceneSupport.show (scene);
    }

}